#!/usr/bin/perl 
use DBI;
use CGI;
# use TTrakerSite;
use TTraker;

& print_header;
& initialize_dbi;
my $form_ref = &parse_input;
my %FORM_DATA = %$form_ref; 
my $num = $FORM_DATA{'empNum'};
my $name = $FORM_DATA{'empName'};
my $job = $FORM_DATA{'empJob'};
my $loc = $FORM_DATA{'empLoc'};
my $cli = $FORM_DATA{'cliID'};

foreach $key (keys %FORM_DATA) {
#  if ($key =~ /^new_std_ADJ/) {
#	print "KEY: $key  VALUE: $FORM_DATA{$key}<br/>";
#  }
  if ($key =~ /^new_std_/ && $FORM_DATA{$key} ne "" ) {
    $id = $key;
    $id =~ s/new_std_//;
    $std = $FORM_DATA{$key};
    update_standard_time ($cli, $id, $std);
  } elsif ($key =~ /^new_rate_/ && $FORM_DATA{$key} ne "" ) {
    $id = $key;
    $id =~ s/new_rate_//;
    $std = $FORM_DATA{$key};
    update_standard_rate ($cli, $id, $std);
#    print "update_standard_time ($cli, $id, $std)<br/>";
  } elsif ($key =~ /^task_/) {
    # do not print tasks that have no value
  } else {   
#   print "KEY: $key - $FORM_DATA{$key}<br/>";   
  } 
}

adm_activity_screen_from_pm ($num, $name, $job, $loc);

db_disconnect();

##################### SUBROUTINES FOLLOW  #####################




sub adm_activity_selection
{

my @dis = ("", "", "", "", "", "", "disabled=\"disabled\"", "disabled=\"disabled\"","disabled=\"disabled\"");
my @col = ("dis","en","en","en","en","en","dis","dis"); 

print <<ENDHEADER;
<html>
<head>
<link rel='stylesheet' type='text/css' href='${css_ref}trak.css' />
<script type='text/javascript' src='${js_ref}trak.js'></script>
<title>trak_02_activity_select</title>
</head>
<body onload='startTime()'>
<h2><center>${banner}</center></h2>
<hr/>
<div id='clock'></div>
<div id='box1'>
Employee Number: <br/><br/>
Employee Name: <br/><br/>
Activity:
</div>
<form id='box2' autocomplete='off' name='activity' action='${cgi_ref}trak_02_adm_activity.pl' method='post'>
<input type="hidden" name=empNum value='$num'/>
<input type="hidden" name=empName value='$name'/>
<input type="hidden" name=empJob value='$job'/>
<input type="hidden" name=empLoc value='$loc'/>
<span>$num</span><br/><br/>
<span>$name</span></b><br/><br/>
<input type="radio" name="activity" value="1" checked="checked"/>&nbsp<$col[1]> Adjust Client Standard Time/Rate</$col[1]><br/>
<input $dis[2] type="radio" name="activity" value="2"/>&nbsp<$col[2]> Adjust Master Standard Time</$col[2]><br/>
<input $dis[3] type="radio" name="activity" value="3"/>&nbsp<$col[3]> Add New Client</$col[3]><br/>
<input $dis[4] type="radio" name="activity" value="4"/>&nbsp<$col[4]> Add Client Task</$col[4]><br/>
<input $dis[5] type="radio" name="activity" value="5"/>&nbsp<$col[5]> Add Master Task</$col[5]><br/>
<input $dis[6] type="radio" name="activity" value="6"/>&nbsp<$col[6]> TBA</$col[6]><br/>
<input $dis[6] type="radio" name="activity" value="7"/>&nbsp<$col[7]> TBA<br/>
<br/>
<input type='submit' value='Proceed'>
<br/><br/>
<a href="${cgi_ref}trak_00_start_up.pl">Return to Log-In</a>
<br/><br/>
<b id="info">$msg</b>
</form>
</body>
</html>

ENDHEADER
}

